using System.Drawing;
using TouchSmart.Gestures;

namespace TouchSmart.Widgets
{
    public class Box : Widget
    {
        private readonly Brush _brush;

        public Box() : this(new Point(0, 0), new Size(0, 0), Color.Black) { }

        public Box(Point location, Size size, Color color) : base(location, size)
        {
            this._brush = new SolidBrush(color);
        }

        public override void Draw(Graphics g)
        {
            g.FillRectangle(this._brush, Location.X, Location.Y, Size.Width, Size.Height);
        }

        public override void OnMovement(MovementEventArgs e)
        {
            if(IsSelected == false) return;

            this.Location = new Point(Location.X + e.Vector.X, Location.Y + e.Vector.Y);
        }
    }
}